//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core;

namespace OpenLS.Spreadsheet.UI.Internals
{
    public class NamedFormat
    {
        public static NamedFormat CreateDateFormat(string formatCode)
        {
            NamedFormat result = new NamedFormat();
            result.FormatCode = formatCode;
            DateTime dateTime = new DateTime(2001, 3, 14, 13, 30, 15);
            result.FormatName = result.Format.GetFormattedValue(dateTime).ToString();
            return result;
        }
        private string name;

        public string FormatName 
        {
            get { return name; }
            set { name = value; }
        }
        Format format;
        public Format Format { get { return format; } }
        public string FormatCode
        {
            get { if (format == null)
                return null; return format.Code;
            }
            set { format = Format.Parse(value); }
        }

        public static NamedFormat CreateNamedFormat(string general, string p1)
        {
            return new NamedFormat() { FormatName = general, FormatCode = p1 }
                ;
        }
    }
}